package com.huluwa.picture.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huluwa.common.core.domain.model.LoginUser;
import com.huluwa.picture.model.dto.space.SpaceAddRequest;
import com.huluwa.picture.model.dto.space.SpaceQueryRequest;
import com.huluwa.picture.model.entity.Space;
import com.huluwa.picture.model.vo.SpaceVO;

import javax.servlet.http.HttpServletRequest;

/**
* @author luyifan
* @description 针对表【space(空间)】的数据库操作Service
* @createDate 2025-01-19 23:19:38
*/
public interface SpaceService extends IService<Space> {

    /**
     * 校验数据
     * @param space
     * @param add
     */
    void validSpace(Space space, boolean add);

    /**
     * 根据空间级别，自动填充限额
     * @param space
     */
    void fillSpaceBySpaceLevel(Space space);

    /**
     * 获取空间包装类
     * @param space
     * @param request
     * @return
     */
    SpaceVO getSpaceVO(Space space, HttpServletRequest request);

    /**
     * 查询参数
     * @param spaceQueryRequest
     * @return
     */
    QueryWrapper<Space> getQueryWrapper(SpaceQueryRequest spaceQueryRequest);

    /**
     * 创建私有空间
     * @param spaceAddRequest
     * @param loginUser
     * @return
     */
    long addSpace(SpaceAddRequest spaceAddRequest, LoginUser loginUser);

    /**
     * 检查权限
     * @param loginUser
     * @param oldSpace
     */
    void checkSpaceAuth(LoginUser loginUser, Space oldSpace);

    /**
     * 获取空间包装类分页
     * @param spacePage
     * @param request
     * @return
     */
    Page<SpaceVO> getSpaceVOPage(Page<Space> spacePage, HttpServletRequest request);
}
